{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "import  turtle  as tt\n",
    "import  math\n",
    "\n",
    "\n",
    "\n",
    "def draw_circle(r):\n",
    "    tt.penup()\n",
    "    tt.goto(0, -r)\n",
    "    tt.seth(0)\n",
    "    tt.pendown()\n",
    "    tt.pensize(5)\n",
    "    tt.color('#F8CD32','#FBA92D')\n",
    "    tt.begin_fill()\n",
    "    tt.circle(r)\n",
    "    tt.end_fill()\n",
    "\n",
    "def draw_petal(r, n):\n",
    "    tt.penup()\n",
    "    tt.goto(0, -r)\n",
    "    tt.seth(0)\n",
    "    tt.pendown()\n",
    "\n",
    "    small_r = math.sin( math.pi/n) * r\n",
    "    \n",
    "    for i in range(n):\n",
    "        tt.penup()\n",
    "        tt.home()\n",
    "        tt.seth((360/n)*i)\n",
    "        tt.fd(r)\n",
    "        tt.left((360/n)*0.5)\n",
    "        tt.pendown()\n",
    "        tt.color('#F0BE7C')\n",
    "        tt.begin_fill()\n",
    "        tt.circle(small_r,180)\n",
    "        tt.end_fill()\n",
    "\n",
    "def draw_square(d, r):\n",
    "    tt.penup()\n",
    "    tt.seth(0)\n",
    "    tt.goto(d/2 + r, -d/2)\n",
    "    tt.left(90)\n",
    "    tt.pendown()\n",
    "    \n",
    "    for i in range(4):\n",
    "        tt.fd(d)\n",
    "        tt.circle(r, 90)\n",
    "\n",
    "def draw_word(word, x, y):\n",
    "    tt.penup()\n",
    "    tt.goto(x, y)\n",
    "    tt.pendown()\n",
    "    tt.color(\"Gold\")\n",
    "    tt.write(word, font=(\"微软雅黑\",35, \"normal\"))\n",
    "\n",
    "\n",
    "\n",
    "def draw():\n",
    "\n",
    "    tt.hideturtle()\n",
    "    tt.speed(20)\n",
    "   \n",
    "    tt.title(\"祝您中秋快乐\")\n",
    "    tt.screensize(200,200)\n",
    "    draw_circle(120)\n",
    "    draw_petal(120,18)\n",
    "    #draw_square(100,10)\n",
    "    draw_word(\"五\",-50,5)\n",
    "    draw_word(\"最\",0,5)\n",
    "    draw_word(\"仁\",-50,-40)\n",
    "    draw_word(\"棒\",0,-40)\n",
    "    tt.done()\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "draw()"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "73e03da126b73bfff3642ec5261d56fa25c444ea595de51041687efaa60dda41"
  },
  "kernelspec": {
   "display_name": "Python 3.8.8 64-bit ('base': conda)",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
